import { createStore } from 'vuex';

interface State {
  selectedAgentIds: string[];
  rightSidebarVisible: boolean;
  // 其他状态...
}

export default createStore<State>({
  state: {
    selectedAgentIds: [], // 存储当前选择的智能体ID
    rightSidebarVisible: false, // 控制右侧文档栏是否显示
    // 其他状态...
  } as State,
  
  mutations: {
    // 设置选中的智能体ID
    SET_SELECTED_AGENT_IDS(state: State, ids: string[]) {
      state.selectedAgentIds = ids;
    },
    
    // 清空选中的智能体ID
    CLEAR_SELECTED_AGENT_IDS(state: State) {
      state.selectedAgentIds = [];
    },
    
    // 添加选中的智能体ID
    ADD_SELECTED_AGENT_ID(state: State, id: string) {
      if (!state.selectedAgentIds.includes(id)) {
        state.selectedAgentIds.push(id);
      }
    },
    
    // 移除选中的智能体ID
    REMOVE_SELECTED_AGENT_ID(state: State, id: string) {
      state.selectedAgentIds = state.selectedAgentIds.filter(agentId => agentId !== id);
    },
    
    // 显示右侧文档栏
    SHOW_RIGHT_SIDEBAR(state: State) {
      state.rightSidebarVisible = true;
    },
    
    // 隐藏右侧文档栏
    HIDE_RIGHT_SIDEBAR(state: State) {
      state.rightSidebarVisible = false;
    },
    
    // 切换右侧文档栏
    TOGGLE_RIGHT_SIDEBAR(state: State) {
      state.rightSidebarVisible = !state.rightSidebarVisible;
    }
  },
  
  actions: {
    // 设置选中的智能体ID
    setSelectedAgentIds({ commit }: { commit: any }, ids: string[]) {
      commit('SET_SELECTED_AGENT_IDS', ids);
    },
    
    // 清空选中的智能体ID
    clearSelectedAgentIds({ commit }: { commit: any }) {
      commit('CLEAR_SELECTED_AGENT_IDS');
    },
    
    // 添加选中的智能体ID
    addSelectedAgentId({ commit }: { commit: any }, id: string) {
      commit('ADD_SELECTED_AGENT_ID', id);
    },
    
    // 移除选中的智能体ID
    removeSelectedAgentId({ commit }: { commit: any }, id: string) {
      commit('REMOVE_SELECTED_AGENT_ID', id);
    },
    
    // 显示右侧文档栏
    showRightSidebar({ commit }: { commit: any }) {
      commit('SHOW_RIGHT_SIDEBAR');
    },
    
    // 隐藏右侧文档栏
    hideRightSidebar({ commit }: { commit: any }) {
      commit('HIDE_RIGHT_SIDEBAR');
    },
    
    // 切换右侧文档栏
    toggleRightSidebar({ commit }: { commit: any }) {
      commit('TOGGLE_RIGHT_SIDEBAR');
    }
  },
  
  modules: {
    // 模块...
  }
}); 